1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gtk.MediaControls;
26 
27 private import glib.ConstructionException;
28 private import gobject.ObjectG;
29 private import gtk.MediaStream;
30 private import gtk.Widget;
31 private import gtk.c.functions;
32 public  import gtk.c.types;
33 
34 
35 /**
36  * `GtkMediaControls` is a widget to show controls for a video.
37  * 
38  * ![An example GtkMediaControls](media-controls.png)
39  * 
40  * Usually, `GtkMediaControls` is used as part of [class@Gtk.Video].
41  */
42 public class MediaControls : Widget
43 {
44 	/** the main Gtk struct */
45 	protected GtkMediaControls* gtkMediaControls;
46 
47 	/** Get the main Gtk struct */
48 	public GtkMediaControls* getMediaControlsStruct(bool transferOwnership = false)
49 	{
50 		if (transferOwnership)
51 			ownedRef = false;
52 		return gtkMediaControls;
53 	}
54 
55 	/** the main Gtk struct as a void* */
56 	protected override void* getStruct()
57 	{
58 		return cast(void*)gtkMediaControls;
59 	}
60 
61 	/**
62 	 * Sets our main struct and passes it to the parent class.
63 	 */
64 	public this (GtkMediaControls* gtkMediaControls, bool ownedRef = false)
65 	{
66 		this.gtkMediaControls = gtkMediaControls;
67 		super(cast(GtkWidget*)gtkMediaControls, ownedRef);
68 	}
69 
70 
71 	/** */
72 	public static GType getType()
73 	{
74 		return gtk_media_controls_get_type();
75 	}
76 
77 	/**
78 	 * Creates a new `GtkMediaControls` managing the @stream passed to it.
79 	 *
80 	 * Params:
81 	 *     stream = a `GtkMediaStream` to manage
82 	 *
83 	 * Returns: a new `GtkMediaControls`
84 	 *
85 	 * Throws: ConstructionException GTK+ fails to create the object.
86 	 */
87 	public this(MediaStream stream)
88 	{
89 		auto __p = gtk_media_controls_new((stream is null) ? null : stream.getMediaStreamStruct());
90 
91 		if(__p is null)
92 		{
93 			throw new ConstructionException("null returned by new");
94 		}
95 
96 		this(cast(GtkMediaControls*) __p);
97 	}
98 
99 	/**
100 	 * Gets the media stream managed by @controls or %NULL if none.
101 	 *
102 	 * Returns: The media stream managed by @controls
103 	 */
104 	public MediaStream getMediaStream()
105 	{
106 		auto __p = gtk_media_controls_get_media_stream(gtkMediaControls);
107 
108 		if(__p is null)
109 		{
110 			return null;
111 		}
112 
113 		return ObjectG.getDObject!(MediaStream)(cast(GtkMediaStream*) __p);
114 	}
115 
116 	/**
117 	 * Sets the stream that is controlled by @controls.
118 	 *
119 	 * Params:
120 	 *     stream = a `GtkMediaStream`
121 	 */
122 	public void setMediaStream(MediaStream stream)
123 	{
124 		gtk_media_controls_set_media_stream(gtkMediaControls, (stream is null) ? null : stream.getMediaStreamStruct());
125 	}
126 }